﻿
using System.Collections;

using DataAccess;
using Model;

namespace Service.ReferenceData
{
    public class ReferenceDataServiceSupplier : ServiceBase
    {

        ReferenceDataAccess mgr;
        public ReferenceDataServiceSupplier()
        {
            mgr = new ReferenceDataAccess();
        }
        public void SaveSupplier(Supplier  supplier)
        {
            mgr.Save(supplier);
        }
        public IList GetCategory()
        {
            return mgr.GetByOrder(typeof(Category), Category.CONST_CATEGORY_NAME);
        }

        public IList GetSupplierById(int supplierId)
        {
            return mgr.GetListByPropertyValueAndOrder(
                typeof(Supplier), 
                Supplier.CONST_SUPPLIER_ID, supplierId,
                Supplier.CONST_SUPPLIER_NAME);
        }

        public IList GetOwnerByCodeNumber(string  codeNumber)
        {
            return mgr.GetListByPropertyValueAndOrder(typeof(Owner), Owner.CONST_CODE_NUMBER, codeNumber ,
                                                      Owner.CONST_CODE_NUMBER);
        }

        public IList GetEmployees()
        {
            return mgr.GetByOrder((typeof(Employee)), Employee.CONST_EMPLOYEE_NAME);
        }

    }
}
